package org.smr.ministore.micro;

import java.util.List;

import org.blade.dao.base.BaseMapper;
import org.blade.utils.IdGenUtils;
import org.smr.ministore.dao.GoodsPriceOrganMapper;
import org.smr.ministore.entities.GoodsPriceOrgan;
import org.smr.ministore.service.GoodsPriceOrganService;
import org.blade.service.base.AbstractService;

import org.blade.utils.Pager;
import org.smr.ministore.service.impl.GoodsPriceOrganFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class GoodsPriceOrganMicroService extends AbstractService<Long, GoodsPriceOrgan> implements GoodsPriceOrganService {

	@Autowired
	private GoodsPriceOrganFacade service;

    public GoodsPriceOrganMicroService(GoodsPriceOrganMapper mapper) {
        super(mapper);
    }

    @ResponseBody
	@RequestMapping(method = RequestMethod.POST, value = "/GoodsPriceOrgan/batchSave")
	public int batchSave(@RequestBody List<GoodsPriceOrgan> entities) {
    	return service.batchSave(entities);
    }

    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/GoodsPriceOrgan/batchModify")
    public int batchModify(List<GoodsPriceOrgan> entities) {
        return service.batchModify(entities);
    }


    @ResponseBody
    @RequestMapping(method = RequestMethod.PUT, value = "/GoodsPriceOrgan/save")
    public int save(@RequestBody GoodsPriceOrgan entity) {
    	return service.save(entity);
    }

    @ResponseBody
    @RequestMapping(method = RequestMethod.PATCH, value = "/GoodsPriceOrgan/updateById")
    public int updateById(@RequestBody GoodsPriceOrgan id) {
   	 	return service.updateById(id);
    }

    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/GoodsPriceOrgan/queryById/{id}")
    public GoodsPriceOrgan queryById( @PathVariable("id")Long id ) {
    	return (GoodsPriceOrgan) service.queryById(id);
    }


    @ResponseBody
    @RequestMapping(method = RequestMethod.DELETE, value = "/GoodsPriceOrgan/deleteById/{id}")
    public int deleteById( @PathVariable("id")Long id ) {
        return service.deleteById(id);
    }

    @Override
    @ResponseBody
    @RequestMapping(method = RequestMethod.DELETE, value = "/GoodsPriceOrgan/deleteByIdLogical/{id}")
    public int deleteByIdLogical(@PathVariable("id") Long id) {
        return this.service.deleteByIdLogical(id);
    }

    @ResponseBody
    @RequestMapping( method = RequestMethod.POST, value = "/GoodsPriceOrgan/paginate/{pageSize}/{pageNum}")
    public Pager<GoodsPriceOrgan> paginate( GoodsPriceOrgan entity, @PathVariable("pageSize")Long pageSize,  @PathVariable("pageNum")Long pageNum ) {

        return this.service.paginate( entity, pageSize, pageNum );
    }


    @Override
    public Long getId() {
        return IdGenUtils.getNextLongId();
    }
}
